package com.ekuaitu.kuaitu.adapter;

import android.content.Context;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.base.BaseRcAdapterHelper;
import com.ekuaitu.kuaitu.base.BaseRcQuickAdapter;
import com.ekuaitu.kuaitu.bean.ChargeDetailBean;

import java.text.DecimalFormat;
import java.util.List;

/**
 * Created by Michael Pi on 2016/12/12.
 */

public class ChargeDetailAdapter extends BaseRcQuickAdapter<ChargeDetailBean.AttachmentBean.RechargeListBean, BaseRcAdapterHelper> {


    public ChargeDetailAdapter(Context context, int layoutResId) {
        super(context, layoutResId);
    }

    @Override
    protected void convert(BaseRcAdapterHelper helper, ChargeDetailBean.AttachmentBean.RechargeListBean item) {
        helper.setText(R.id.tv_charge_detail_sn, item.getOrderNum());
        helper.setText(R.id.tv_charge_detail_time, item.getOrderTime());
        if (item.getRechargeType() == 2) {
            helper.setText(R.id.tv_charge_detail_method, "微信支付");
        } else if (item.getRechargeType() == 1) {
            helper.setText(R.id.tv_charge_detail_method, "支付宝支付");
        }
        DecimalFormat df1 = new DecimalFormat("0.00");
        helper.setText(R.id.tv_charge_detail_money, "￥" + df1.format(item.getRechargeMoney()));
        DecimalFormat df2 = new DecimalFormat("0.00");
        helper.setText(R.id.tv_charge_detail_promote, "返" + df2.format(item.getPromoteMoney()) + "元");
    }
}
